function delHtmlTag(str) {
    str = str.replace(/&nbsp;/ig, "");
    return str.replace(/<[^>]+>/g, "");//去掉所有的html标记
}

//iframe 自适应高度
function iFrameHeight(iframepage) {
    var ifm = document.getElementById(iframepage);
    var subWeb = document.frames ? document.frames[iframepage].document :
            ifm.contentDocument;
    if (ifm != null && subWeb != null) {
        ifm.height = subWeb.body.scrollHeight;
    }
}

//弹窗得到约课信息  参数obj:对象
function getClassInformation(obj) {
    var data_name = obj.data("name");
    var data_time = obj.data("time");
    var data_subject = obj.data("subject");
    var data_address = obj.data("address");
    var data_booktime = obj.data("booktime");
    $(".data-name").html(data_name);
    $(".data-time").html(data_time);
    $(".data-booktime").html(data_booktime);
    $(".data-subject").html(data_subject);
    $(".data-address").html(data_address);
}

//弹窗得到约课信息补充 (不能写在getClassInformation里)

function getClassState(obj){
    
}

//钱包页面

function walletBank() {
    /**
     × JQUERY 银行帐号输入
     **/
    $.fn.bankInput = function (options) {
        var defaults = {
            min: 10, // 最少输入字数
            max: 25, // 最多输入字数
            deimiter: ' ', // 账号分隔符
            onlyNumber: true, // 只能输入数字
            copy: true // 允许复制
        };
        var opts = $.extend({}, defaults, options);
        var obj = $(this);
        if (obj.length>0) {
            obj.css({imeMode: 'Disabled', borderWidth: '1px', color: '#000', fontFamly: 'Times New Roman'}).attr('maxlength', opts.max);
            if (obj.val() != '')
                obj.val(obj.val().replace(/\s/g, '').replace(/(\d{4})(?=\d)/g, "$1" + opts.deimiter));
            obj.bind('keyup', function (event) {
                if (opts.onlyNumber) {
                    if (!(event.keyCode >= 48 && event.keyCode <= 57)) {
                        this.value = this.value.replace(/\D/g, '');
                    }
                }
                this.value = this.value.replace(/\s/g, '').replace(/(\d{4})(?=\d)/g, "$1" + opts.deimiter);
            }).bind('dragenter', function () {
                return false;
            }).bind('onpaste', function () {
                return !clipboardData.getData('text').match(/\D/);
            }).bind('blur', function () {
                this.value = this.value.replace(/\s/g, '').replace(/(\d{4})(?=\d)/g, "$1" + opts.deimiter);
                if (this.value.length < opts.min) {
//                        alertMsg.warn('最少输入' + opts.min + '位账号信息！');
                    $("#account").css("border", "1px solid red");
                    obj.focus();
                } else {
                    $("#account").css("border", "1px solid #ccc");
                }
            })
        }
    }
// 列表显示格式化
    $.fn.bankList = function (options) {
        var defaults = {
            deimiter: ' ' // 分隔符
        };
        var opts = $.extend({}, defaults, options);
        return this.each(function () {
            $(this).text($(this).text().replace(/\s/g, '').replace(/(\d{4})(?=\d)/g, "$1" + opts.deimiter));
        })
    }
}
//账户类别页面 点击绑定用户
$(function(){
    $(".bound").click(function () {
        var data_id = $(this).attr("data-id");
//        console.log(data_id);
        $("input[name='bound-id']").attr("value",""+data_id+"");
        $("#boundForm").submit();
    })
})



